init{
  this.scenarios=findScenarios();
  if (scenarios != null && scenarios.size() > 0) {
    init(scenarios.get(0));
}
init{
  this.scenarios=findScenarios();
  for (  Scenario scenario : scenarios) {
    if (scenarioString.equals(scenario.getName())) {
      initScenario=scenario;
}
init{
  org.apache.log4j.Logger.getRootLogger().addAppender(new LogAppender());
  currentScenario=scenario;
  if (scenarios == null) {
    scenarios=new ArrayList<Scenario>();
    scenarios.add(scenario);
  this.entityStateFactory=new NodeEntityStateFactory();
  this.entityStateFactory.setTemplate(template);
  this.entityStateFactory.setNodeDelegatingFieldAccessorFactory(new NodeDelegatingFieldAccessorFactory(template));
  this.loadScenario(this.currentScenario);
}
start{
  if (!this.scenarioLoaded) {
    this.loadScenario(this.currentScenario);
}
stop{
  simulation.stopSimulation();
}
pause{
  simulation.pauseSimulation();
}
resume{
  simulation.resumeSimulation();
}
listen{
synchronized (this.waiter) {
        e.printStackTrace();
synchronized (this.events) {
}
popLog{
  if (!this.log.isEmpty()) {
}
getCurrentTick{ }
flush{ }
getState{ }
wake{ }
release{ }
requiresLayout{ }
close{ }
append{
    events.add(EngineEvent.LOG_MESSAGE);
synchronized (waiter) {
    waiter.notifyAll();
}
act{
synchronized (events) {
    events.add(event);
}
getCurrentScenario{ }
getScenarioParameters{ }
getScenarios{
  String[] scenarioArray=new String[this.scenarios.size()];
    scenarioArray[i]=this.scenarios.get(i).getName();
}
loadScenario{
  for (  Scenario scen : this.scenarios) {
    if (scenario.equals(scen)) {
  try {
  this.context=new ClassPathXmlApplicationContext(configs,this.applicationContext);
  if (!this.currentScenario.equals(found) || this.scenarioParameters.isEmpty()) {
    this.scenarioParameters.clear();
    String[] names=this.context.getBeanNamesForType(Object.class);
    for (    String beanName : names) {
      Object bean=this.context.getBean(beanName);
      ArrayList<java.lang.reflect.Field> fields=new ArrayList<java.lang.reflect.Field>();
      Class<?> clazz=bean.getClass();
        for (        java.lang.reflect.Field field : clazz.getDeclaredFields()) {
          fields.add(field);
        clazz=clazz.getSuperclass();
 while (clazz != null);
      clazz=bean.getClass();
      for (      java.lang.reflect.Field field : fields) {
        String name=field.getName();
        SimulationParameter annotation=field.getAnnotation(SimulationParameter.class);
          try {
            Class<?> fieldType=field.getType();
            if (fieldType.equals(Boolean.class) || fieldType.equals(boolean.class)) {
              getter=bean.getClass().getMethod("is" + this.capitalize(name));
              getter=bean.getClass().getMethod("get" + this.capitalize(name));
            throw new RuntimeException(e);
          ConfigurableObject cfgObj=this.scenarioParameters.get(beanName);
          if (cfgObj == null) {
            cfgObj=new ConfigurableObject(beanName,clazz.getName());
            this.scenarioParameters.put(beanName,cfgObj);
          ScenarioParameter parameter=new ScenarioParameter(name,value,annotation.label());
          if (!Double.isNaN(annotation.from()) && !Double.isNaN(annotation.to())) {
          if (!Double.isNaN(annotation.step())) {
            parameter.setStep(annotation.step());
          cfgObj.addParameter(parameter);
}
loadScenario{
  for (  Scenario scen : this.scenarios) {
  if (scenario != null)   loadScenario(scenario);
}
setScenarioParameters{
  for (  String obj : parameters.keySet()) {
    if (!this.scenarioParameters.containsKey(obj)) {
    Map<String,ScenarioParameter> newParams=parameters.get(obj);
      if (!oldObj.containsParam(field)) {
      oldObj.setParamValue(field,newParam.getValue());
}
setScenarioParameter{
  if (!this.scenarioParameters.containsKey(obj)) {
}
updateScenarioParameters{
  for (  ConfigurableObject configObj : this.scenarioParameters.values()) {
    String beanName=configObj.getId();
    Object bean=this.context.getBean(beanName);
    Class<?> clazz=bean.getClass();
    HashMap<String,java.lang.reflect.Field> declaredFields=new HashMap<String,java.lang.reflect.Field>();
      for (      java.lang.reflect.Field field : clazz.getDeclaredFields()) {
        declaredFields.put(field.getName(),field);
      clazz=clazz.getSuperclass();
 while (clazz != null);
    clazz=bean.getClass();
    for (    ScenarioParameter parameter : configObj.getParameters()) {
      String field=this.capitalize(parameter.getField());
      Object value=parameter.getValue();
      Method[] methods=clazz.getMethods();
      for (      Method method : methods) {
        if (method.getName().equals("set" + field)) {
            method.invoke(bean,value);
 catch (          Exception e) {
            throw new RuntimeException(e);
            ((NodeBacked)bean).persist();
}
capitalize{
  return string.substring(0,1).toUpperCase() + string.substring(1,string.length());
}
findScenarios{
    URL url=this.getClass().getResource(SCENARIO_FOLDER);
    if (!url.getProtocol().contains("jar")) {
      File scenarioFolder=new File(url.toURI());
        File[] scenarios=scenarioFolder.listFiles(new FilenameFilter(){
          @Override public boolean accept(          File dir,          String name){
        List<Scenario> sList=new ArrayList<Scenario>();
        for (        File sf : scenarios) {
          sList.add(new Scenario(sf.getName(),sf.getAbsolutePath()));
        return sList;
      List<Scenario> sList=new ArrayList<Scenario>();
      CodeSource src=this.getClass().getProtectionDomain().getCodeSource();
      URL jar=src.getLocation();
      ZipInputStream zip=new ZipInputStream(jar.openStream());
      ZipEntry ze=null;
      while ((ze=zip.getNextEntry()) != null) {
        String entryName=ze.getName();
        if (entryName.contains(SCENARIO_FOLDER.substring(1)) && entryName.endsWith(".xml")) {
          String scenarioName=entryName.substring(SCENARIO_FOLDER.length());
          String path=jar + entryName;
          sList.add(new Scenario(scenarioName,path));
      return sList;
}
accept{
  return (name.endsWith(".xml"));
}
setApplicationContext{ }
